function init() {
	// 绑定选中事件
	$("#selectAllChecked").click(function() {
		var value = $("#selectAllChecked").attr("checked");
		
		if(value == "checked") {
			$("input:not(:checked)").attr("checked", true);
		} else {
			$("input:checked").attr("checked", false);
		}
	});
}

function printAllExpressPage() {
//	var array = new Array();
	var express = $("#express").val();
	 
	var param = "";
	$("input:checked").each(function(index) {
		//array.push($(this).val());
		param += "tids=" + $(this).val() + "&";
	});
	
	param = param.replace(/tids=on&/, "");
	param = param.substring(0, param.length - 1);
	
	$.get('./express/printExpress.action?' + param + '&expressCode=' +  express + '&mutilTids=true', function(data) {
		alert(data);
	});
}

function printExpressPage(tid) {
	var express = $("#express").val();
	$.get('./express/printExpress.action', { tid: tid, expressCode: express, mutilTids: false }, function(data) {
		alert(data);
	});
}

function openUrl(tid) {
	var width = 800;
	var height = 350;
	
	var top = (window.screen.height - height) / 2 - 100;
    var left = (window.screen.width - width) / 2;
    
	window.showModalDialog('send.jsp?tid=' + tid + '&expressName=' + $("#express").val(), window, "dialogWidth: " + width + "px; dialogHeight: " + height + "px; dialogLeft:" + left + "px; dialogTop:" + top + "px  center: yes; toolbar:no;resizable: no;scrollbars:no status: no; location: yes");
}

function showBowParam(productCollectId) {
	var width = 800;
	var height = 350;
	
	var top = (window.screen.height - height) / 2 - 100;
    var left = (window.screen.width - width) / 2;
    
	window.showModalDialog('./taobao/showBowParam.action?productCollectId=' + productCollectId, window, "dialogWidth: " + width + "px; dialogHeight: " + height + "px; dialogLeft:" + left + "px; dialogTop:" + top + "px  center: yes; toolbar:no;resizable: no;scrollbars:no status: no; location: yes");
}

function searchLog(tid) {
	$.get('./express/expressTrace.action', { tid: tid }, function(data) {
		var html = "";
		
		$(" #dialog-searchTrace ").empty();
		
		if(data.match("empty") != null) {
			html = "<p>" + data + "</p>";
			$(" #dialog-searchTrace ").append(html);
		} else if(data.match("error:") == null) {
			var json =  eval( "("+ data + ")");
		   	
		   	html = "<table align='center' id='searchTrace'><tr><td colspan='2'>快递单公司名称: " + json.company_name + "</td></tr><tr><td colspan='2'>运单号: " + json.out_sid + "</td></tr><tr><td colspan='2'>淘宝订单号: " + json.tid + "</td></tr>:traceList</table>";
		   	var traceList = "";
		   	for(var i = 0; i < json.data.length; i ++) {
		   		traceList += "<tr>";
		   		traceList += "<td>" + json.data[i].time + "</td>";
		   		traceList += "<td>" + json.data[i].context + "</td>";
		   		traceList += "</tr>";
		   	}
		   	
		   	html = html.replace(":traceList", traceList);
		   	$(" #dialog-searchTrace ").append(html);
		   	$("#searchTrace tr:eq(3)").css("background-color", "green");
		} else {
			html = "<p>" + data + "</p>";
			$(" #dialog-searchTrace ").append(html);
		}
		
		$( "#dialog-searchTrace" ).dialog({
		    width: 700,
			height: 400,
			modal: true
	    });
   });
}